<?php
class ui_friend_default extends ui {
	public function __construct($S, $param) {
		parent::__construct();
		
		if ($this->uid) {
			// Nav
			$S->assign('nav', loadMod('glob/nav/0/0'));
			
			// 显示各账号的登陆情况
			$account_info = $this->account_info($this->uid);
			$S->assign('account_info',	$account_info);
			
			// 列表用ajax显示
		} else {
			die2page('http://uread.me');
		}
	}
	/**
	 * 在show_setting中
	 * 
	 * @param type $uid
	 * @param type $me
	 * @return type
	 */
	public static function account_info ($uid) {
		$data_user = new data_user();
		$me = $data_user->one($uid);
		$data_social = new data_social();
		// 新浪微博账号
		if ($me['weibo_id']) {
			$isbind[] = array (
				'img'		=> '<img src="/images/icon_weibo_16.png" width=16 height=16 style="margin:0 2px; vertical-align: middle;" title="新浪微博已经绑定">',
				'name'	=> $me['weibo_actionname'],
                                'flag'  => 'weibo',
			);
		} else {
			$nobind[] = array (
				'img'		=> '<img src="/images/login_weibo.png" width=126 height=24 style="margin:0 1px; vertical-align: middle;" title="点击进入新浪微博授权页面">',
				'link'		=> $data_social->get_authorize_url('weibo', 'setting'),
			);
		}
		// 人人网账号
		if ($me['renren_id']) {
			$isbind[] = array (
				'img'		=> '<img src="/images/icon_renren_16.png" width=16 height=16 style="margin:0 2px; vertical-align: middle;" title="人人网已经绑定">',
				'name'	=> $me['renren_actionname'],
                                'flag'  => 'renren',
			);
		} else {
			$nobind[] = array (
				'img'		=> '<img src="/images/login_renren.png" width=126 height=24 style="margin:0 1px; vertical-align: middle;" title="点击进入人人网授权页面">',
				'link'		=> $data_social->get_authorize_url('renren', 'setting'),
			);
		}
		// 开心网账号
		if ($me['kaixin001_id']) {
			$isbind[] = array (
				'img'		=> '<img src="/images/icon_kaixin001_16.png" width=16 height=16 style="margin:0 2px; vertical-align: middle;" title="开心网已经绑定">',
				'name'	=> $me['kaixin001_actionname'],
                                'flag'  => 'kaixin001',
			);
		} else {
			$nobind[] = array (
				'img'		=> '<img src="/images/login_kaixin001.png" width=126 height=24 style="margin:0 1px; vertical-align: middle;" title="点击进入开心网授权页面">',
				'link'		=> $data_social->get_authorize_url('kaixin001', 'setting'),
			);
		}
		// 腾讯微博账号
		if ($me['qqwb_id']) {
			$isbind[] = array (
				'img'		=> '<img src="/images/icon_qqwb_16.png" width=16 height=16 style="margin:0 2px; vertical-align: middle;" title="腾讯微博已经绑定">',
				'name'	=> $me['qqwb_showname'],
                                'flag'  => 'qqwb',
			);
		} else {
			$nobind[] = array (
				'img'		=> '<img src="/images/login_qqwb.png" width=126 height=24 style="margin:0 1px; vertical-align: middle;" title="点击进入腾讯微博授权页面">',
				'link'		=> $data_social->get_authorize_url('qqwb', 'setting'),
			);
		}
		
		return array (
			'isbind'	=> $isbind,
			'nobind'	=> $nobind,
		);
	}
}
?>